<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form id="form1" method="POST" class="form-horizontal" role="form" enctype="multipart/form-data">
    <label class="col-sm-3 control-label" for="image">图片：</label>
    <div class="col-sm-9 require">
        <input type="hidden" name="MAX_FILE_SIZE" value="2000000">
        <input type="file" class="form-control" name="image" id="image">
    </div>
    <input type="submit">
    </div>
</form>
</body>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script>
    $('#form1').submit(function (e) {
        e.preventDefault();
        var data=new FormData(this);//获取非文本类的数据
        $.ajax({
            url:"http://127.0.0.1:90/index.php/web/upload_file",//处理页面的路径
            data:data,//通过json格式将一组数据传过去
            type:"post",//数据的提交和传递方式，最好用POST
            dataType:"json",//页面返回值的类型，共有三种：TEXT,JSON,XML可选
            cache:false,
            contentType:false,
            processData:false,
            success: function(res){
                console.log(res)
            }
        });
    });
</script>
</html>